package org.example.stream.demo;

import org.example.stream.demo.entity.User;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class FilterMain {
    public static void main(String[] args) {
        List<User> list = UserBuilder.bindings();

        List<User> l1 = list.stream().filter(l -> l.getAge() >= 80).collect(Collectors.toList());
        System.out.println(l1);

        Map<String, String> m1 = list.stream().filter(l -> l.getAge() >= 20).collect(Collectors.toMap(User::getId, User::getName));
        System.out.println(m1);
    }
}
